<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ page import="java.util.Date,java.text.*" %>

<%@page contentType="text/html" pageEncoding="UTF-8" errorPage="error.jsp"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<sql:setDataSource driver="${applicationScope.dbdriver}"
                   url="${applicationScope.connstr}"/>
<c:choose>
    <c:when test="${param.savewhat == 'personalInfo'}">
        <sql:update>
             UPDATE profile SET first_name=?, last_name=?, contact=?, birthdate=?, email=?, comp_name=?, username=?
             <sql:param value="${fn:trim(param.firstName)}"/>
             <sql:param value="${fn:trim(param.lastName)}"/>
             <sql:param value="${fn:trim(param.contact)}"/>
             <sql:param value="${fn:trim(param.birthdate)}"/>
             <sql:param value="${fn:trim(param.emailAdd)}"/>
             <sql:param value="${fn:trim(param.companyName)}"/>
             <sql:param value="${fn:trim(param.username)}"/> WHERE username = "${fn:trim(param.username)}"
        </sql:update>
        <c:redirect url="customerProfile.jsp"/>
    </c:when>
</c:choose>
